package com.xuxin.nantai.presenter;

import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.contract.PasswordContract;
import com.xuxin.nantai.model.PasswordModel;

/**
 * Created by xu_xin
 * Created on 2020.06.11 0011
 */
public class PasswordPresenter implements PasswordContract.Presenter {
    private PasswordModel model;
    private PasswordContract.View view;

    public PasswordPresenter(PasswordContract.View view) {
        model = new PasswordModel();
        this.view = view;
    }

    @Override
    public void updatePassword(String loginName, String oldPassword, String newPassword) {
        if (null != model) {
            model.updatePassword(this, loginName, oldPassword, newPassword);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}